<template>
  <div class="app-container">




<!--    {{this.$route.query}}-->
    {{menuList}}
    <el-table  :data="menuList" >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="菜品名称" align="center" prop="menuName" />
      <el-table-column label="菜品价格" align="center" prop="menuPrice" />
      <el-table-column label="菜品数量" align="center" prop="menuCount" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
      </el-table-column>
    </el-table>
        <el-button @click="Submitorder()">
            提交订单
        </el-button>



  </div>
</template>

<script>
import { listOrder, getOrder, delOrder, addOrder, updateOrder,addnewOrder } from "@/api/order/order";
import { listMenu, getMenu, delMenu, addMenu, updateMenu ,importExport ,myshoppingcart,cartList} from "@/api/menu/menu";
export default {
  name: "Menu",
  data() {
    return {
      // 菜品表格数据
      menuList: [],
      tableId:null,
      merchantId:null

    };
  },
  created() {
    this.getList();
    console.log(this.$route.query)
    this.tableId=this.$route.query.tableId;
    this.merchantId=this.$route.query.merchantId;
  },
  methods: {
    Submitorder(){
      debugger
      const  orderDTO={
        "menus":this.menuList,
        "tableId":this.tableId,
      }
      addnewOrder(orderDTO).then(res=>{
        debugger
          if(res){
            console.log(res)
            this.$message.success("添加成功")
          }
      })
    },

    /** 查询菜品列表 */
    getList() {
      cartList().then(res=>{
        this.menuList =res;
      })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },

    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },











  }
};
</script>
